<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="includes/add-include :: add-header"></head>
<link th:href="@{/plugin/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
<style>
	.form-group{
		display: inline-block;
	}
	.col-sm-3{
		padding-left: 30px
	}
	.col-sm-5{
		padding-left: 5px;
		display: inline-block;
	}
	#tree{
		padding: 11px 130px;
	}
	#myForm{
		padding-top: 10px;
	}

</style>
<body class="hold-transition box box-main">
	<form id="myForm" class="form-inline">
		<input id="treeId"   name="treeId"    type="hidden" th:value="${menu.menuId}"/>
		<input id="treeName" name="treeName"  type="hidden" th:value="${menu.menuName}"/>

		<div class="row">
			<div class="form-group">
				<label class="col-sm-3 control-label" for="keyword">关键字：</label>
				<div class="col-sm-5">
					<input id="keyword" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<a class="btn btn-info btn-rounded btn-rd" onclick="$.tree.searchNode()"><i class="fa fa-search"></i>&nbsp;搜索</a>
				<a class="btn btn-success btn-rounded btn-rd" onclick="$.tree.expand()"><i class="fa fa-refresh"></i>&nbsp;展开</a>
				<a class="btn btn-primary btn-rounded btn-rd" onclick="$.tree.collapse()"><i class="fa fa-refresh"></i>&nbsp;折叠</a>
			</div>
		</div>
	</form>

	<div style="" id="tree" class="ztree treeselect"></div>
	</div>
	<div th:include="includes/add-include :: add-footer"></div>
	<script th:src="@{/plugin/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script th:inline="javascript">
		$(function() {
			var url = ctx + "system/menu/menuTreeData";
			var options = {
		        url: url,
		        expandLevel: 1,
		        onClick : zOnClick
		    };
			$.tree.init(options);
		});

		function zOnClick(event, treeId, treeNode) {
		    var treeId = treeNode.id;
		    var treeName = treeNode.name;
		    $("#treeId").val(treeId);
		    $("#treeName").val(treeName);
		}
	</script>
</body>
</html>
